﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.IO;


namespace App1
{
    public partial class frmMain : Form
    {
        private frmNewGame _theNew = new frmNewGame();
        private Bitmap _bmp;

        int pler = 0;// luu player dang su dung network
        string name;

        private static bool _Network = false;

        public static bool Network
        {
            get { return frmMain._Network; }
            set { frmMain._Network = value; }
        }

      //  SocKet soc;//= new SocKet();
        Thread t1;

        private ListBox _lstChat;

       

        public frmMain()
        {
            InitializeComponent();
        }

        protected override void OnPaintBackground(PaintEventArgs e)
        {
            //base.OnPaintBackground(e);
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            //base.OnPaint(e);
            e.Graphics.DrawImage(_bmp, 0, 0, this.Width, this.Height);
        }

        public void AddPiece()
        {
            int i = 0;
            while(i < 2)
            {
                this.picBoard.Controls.Add(GameChess.Player[i].Pawns[0].pic);
                this.picBoard.Controls.Add(GameChess.Player[i].Pawns[1].pic);
                this.picBoard.Controls.Add(GameChess.Player[i].Pawns[2].pic);
                this.picBoard.Controls.Add(GameChess.Player[i].Pawns[3].pic);
                this.picBoard.Controls.Add(GameChess.Player[i].Pawns[4].pic);
                this.picBoard.Controls.Add(GameChess.Player[i].Guards[0].pic);
                this.picBoard.Controls.Add(GameChess.Player[i].Guards[1].pic);
                this.picBoard.Controls.Add(GameChess.Player[i].Elephants[0].pic);
                this.picBoard.Controls.Add(GameChess.Player[i].Elephants[1].pic);
                this.picBoard.Controls.Add(GameChess.Player[i].Horses[0].pic);
                this.picBoard.Controls.Add(GameChess.Player[i].Horses[1].pic);
                this.picBoard.Controls.Add(GameChess.Player[i].Cannons[0].pic);
                this.picBoard.Controls.Add(GameChess.Player[i].Cannons[1].pic);
                this.picBoard.Controls.Add(GameChess.Player[i].Rooks[0].pic);
                this.picBoard.Controls.Add(GameChess.Player[i].Rooks[1].pic);
                this.picBoard.Controls.Add(GameChess.Player[i].King.pic);
                ++i;
            }
        }

        private void tStrpBtnNew_Click(object sender, EventArgs e)
        {
            if (!GameChess.Marked)
            {
                if (!GameChess.OnPlay)
                {
                    _theNew.ShowDialog(this);
                }

                if (GameChess.OnPlay)
                {
                    for (int row = 0; row < 10; ++row)
                        for (int col = 0; col < 9; ++col)
                        {
                            this.picBoard.Controls.Add(Board.Square[row, col].PicCanMove);
                            Board.Square[row, col].PicCanMove.MouseClick += new MouseEventHandler(PicCanMove_MouseClick);
                        }
                    AddPiece();
                }
            }
        }

        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!GameChess.Marked)
            {
                if (!GameChess.OnPlay)
                {
                    _theNew.ShowDialog(this);
                }

                if (GameChess.OnPlay)
                {
                    for (int row = 0; row < 10; ++row)
                        for (int col = 0; col < 9; ++col)
                        {
                            this.picBoard.Controls.Add(Board.Square[row, col].PicCanMove);
                            Board.Square[row, col].PicCanMove.MouseClick += new MouseEventHandler(PicCanMove_MouseClick);
                        }
                    AddPiece();
                }
            }
        }

        private void PicCanMove_MouseClick(Object sender, MouseEventArgs e)
        { 
            for(int row = 0; row < 10; ++row)
                for (int col = 0; col < 9; ++col)
                {
                    if (sender.Equals(Board.Square[row, col].PicCanMove) && GameChess.Marked)
                    {
                        GameChess.PieceMark.SetImage();
                        if (Board.Square[row, col].State)
                        {

                            int temp = 3;
                            if (GameChess.PieceMark.Side == 1)
                                temp = 1;
                            else
                                temp = 0;
                            Pieces pieceTemp = new Pieces();

                            switch (Board.Square[row, col].Value)
                            {
                                case 1:
                                    if (Board.Square[row, col].Piece == "Pawn0")
                                        pieceTemp = GameChess.Player[temp].Pawns[0];
                                    else if (Board.Square[row, col].Piece == "Pawn1")
                                        pieceTemp = GameChess.Player[temp].Pawns[1];
                                    else if (Board.Square[row, col].Piece == "Pawn2")
                                        pieceTemp = GameChess.Player[temp].Pawns[2];
                                    else if (Board.Square[row, col].Piece == "Pawn3")
                                        pieceTemp = GameChess.Player[temp].Pawns[3];
                                    else if (Board.Square[row, col].Piece == "Pawn4")
                                        pieceTemp = GameChess.Player[temp].Pawns[4];
                                    break;
                                case 2:
                                    if (Board.Square[row, col].Piece == "Guard0")
                                        pieceTemp = GameChess.Player[temp].Guards[0];
                                    else if (Board.Square[row, col].Piece == "Guard1")
                                        pieceTemp = GameChess.Player[temp].Guards[1];
                                    break;
                                case 3:
                                    if (Board.Square[row, col].Piece == "Elephant0")
                                        pieceTemp = GameChess.Player[temp].Elephants[0];
                                    else if (Board.Square[row, col].Piece == "Elephant1")
                                        pieceTemp = GameChess.Player[temp].Elephants[1];
                                    break;
                                case 4:
                                    if (Board.Square[row, col].Piece == "Horse0")
                                        pieceTemp = GameChess.Player[temp].Horses[0];
                                    else if (Board.Square[row, col].Piece == "Horse1")
                                        pieceTemp = GameChess.Player[temp].Horses[1];
                                    break;
                                case 5:
                                    if (Board.Square[row, col].Piece == "Cannon0")
                                        pieceTemp = GameChess.Player[temp].Cannons[0];
                                    else if (Board.Square[row, col].Piece == "Cannon1")
                                        pieceTemp = GameChess.Player[temp].Cannons[1];
                                    break;
                                case 6:
                                    if (Board.Square[row, col].Piece == "Rook0")
                                        pieceTemp = GameChess.Player[temp].Rooks[0];
                                    else if (Board.Square[row, col].Piece == "Rook1")
                                        pieceTemp = GameChess.Player[temp].Rooks[1];
                                    break;
                                case 7:
                                    pieceTemp = GameChess.Player[temp].King;
                                    break;
                            }
                            GameChess.KillPiece(pieceTemp);
                        }
                        GameChess.Marked = false;
                        GameChess.SaveToLogMove(GameChess.PieceMark);
                        GameChess.MakeEmptySquare(GameChess.PieceMark.Row, GameChess.PieceMark.Col);
                        GameChess.SetPieceOnBoard(GameChess.PieceMark, row, col);
                        
                        Board.UpdatePicCanMove();
                        GameChess.CheckCheck();
                        GameChess.ChangeTurn();
                        GameChess.CheckStalemate();
                        if (frmMain.Network)
                        {
                            Client.Send_Server("1");
                            Client.Send_Server(GameChess.PieceMark.Row.ToString() + " " + GameChess.PieceMark.Col.ToString() + " " + GameChess.PieceMark.Name.ToString() + " " + GameChess.PieceMark.Side.ToString() + " " + GameChess.PieceMark.Value.ToString());


                        }
                        //Board.UpdatePicCanMove();
                    }
                }
        }

        private void frmMain_Load(object sender, EventArgs e)
        {

            Control.CheckForIllegalCrossThreadCalls = false;

            _bmp = new Bitmap(this.Width, this.Height);
            Bitmap bmp = new Bitmap(Properties.Resources._5038);
            Graphics g = Graphics.FromImage(_bmp);
            g.Clear(this.BackColor);
            g.DrawImage(bmp, 0, 0);
            g.Dispose();
            this.Refresh();
            this.Validate();

            txtIpServer.Text = "127.0.0.1";// dia cchi IP cua server cung 1 may voi client

        }

        private void picBoard_MouseClick(Object sender, MouseEventArgs e)
        {
            Pieces pieceTemp = new Pieces();
            if (GameChess.Marked)
            {
                GameChess.Marked = false;

                switch (GameChess.PieceMark.Value)
                {
                    case 1:
                        if (GameChess.PieceMark.Name == "Pawn0")
                            pieceTemp = GameChess.Player[GameChess.PieceMark.Side - 1].Pawns[0];
                        else if (GameChess.PieceMark.Name == "Pawn1")             
                            pieceTemp = GameChess.Player[GameChess.PieceMark.Side - 1].Pawns[1];
                        else if (GameChess.PieceMark.Name == "Pawn2")             
                            pieceTemp = GameChess.Player[GameChess.PieceMark.Side - 1].Pawns[2];
                        else if (GameChess.PieceMark.Name == "Pawn3")             
                            pieceTemp = GameChess.Player[GameChess.PieceMark.Side - 1].Pawns[3];
                        else if (GameChess.PieceMark.Name == "Pawn4")             
                            pieceTemp = GameChess.Player[GameChess.PieceMark.Side - 1].Pawns[4];
                        break;
                    case 2:
                        if (GameChess.PieceMark.Name == "Guard0")
                            pieceTemp = GameChess.Player[GameChess.PieceMark.Side - 1].Guards[0];
                        else if (GameChess.PieceMark.Name == "Guard1")
                            pieceTemp = GameChess.Player[GameChess.PieceMark.Side - 1].Guards[1];
                        break;
                    case 3:
                        if (GameChess.PieceMark.Name == "Elephant0")
                            pieceTemp = GameChess.Player[GameChess.PieceMark.Side - 1].Elephants[0];
                        else if (GameChess.PieceMark.Name == "Elephant1")
                            pieceTemp = GameChess.Player[GameChess.PieceMark.Side - 1].Elephants[1];
                        break;
                    case 4:
                        if (GameChess.PieceMark.Name == "Horse0")
                            pieceTemp = GameChess.Player[GameChess.PieceMark.Side - 1].Horses[0];
                        else if (GameChess.PieceMark.Name == "Horse1")
                            pieceTemp = GameChess.Player[GameChess.PieceMark.Side - 1].Horses[1];
                        break;
                    case 5:
                        if (GameChess.PieceMark.Name == "Cannon0")
                            pieceTemp = GameChess.Player[GameChess.PieceMark.Side - 1].Cannons[0];
                        else if (GameChess.PieceMark.Name == "Cannon1")
                            pieceTemp = GameChess.Player[GameChess.PieceMark.Side - 1].Cannons[1];
                        break;
                    case 6:
                        if (GameChess.PieceMark.Name == "Rook0")
                            pieceTemp = GameChess.Player[GameChess.PieceMark.Side - 1].Rooks[0];
                        else if (GameChess.PieceMark.Name == "Rook1")
                            pieceTemp = GameChess.Player[GameChess.PieceMark.Side - 1].Rooks[1];
                        break;
                    case 7:
                        pieceTemp = GameChess.Player[GameChess.PieceMark.Side - 1].King;
                        break;
                }
                pieceTemp.SetImage();
                Board.UpdatePicCanMove();
            }
        }

        private void tStrpBtnSave_Click(object sender, EventArgs e)
        {
            frmSave save = new frmSave();
            save.ShowDialog(this); 
        }

        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmSave save = new frmSave();
            save.ShowDialog(this); 
        }

        private void tStrpBtnOpen_Click(object sender, EventArgs e)
        {
            if (!GameChess.Marked)
            {
                if (!GameChess.OnPlay)
                {
                    frmOpen open = new frmOpen();
                    open.ShowDialog(this);
                }

                if (GameChess.OnPlay)
                {
                    for (int row = 0; row < 10; ++row)
                        for (int col = 0; col < 9; ++col)
                        {
                            this.picBoard.Controls.Add(Board.Square[row, col].PicCanMove);
                            Board.Square[row, col].PicCanMove.MouseClick += new MouseEventHandler(PicCanMove_MouseClick);
                        }
                    AddPiece();
                }
            }
        }

        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!GameChess.Marked)
            {
                if (!GameChess.OnPlay)
                {
                    frmOpen open = new frmOpen();
                    open.ShowDialog(this);
                }

                if (GameChess.OnPlay)
                {
                    for (int row = 0; row < 10; ++row)
                        for (int col = 0; col < 9; ++col)
                        {
                            this.picBoard.Controls.Add(Board.Square[row, col].PicCanMove);
                            Board.Square[row, col].PicCanMove.MouseClick += new MouseEventHandler(PicCanMove_MouseClick);
                        }
                    AddPiece();
                }
            }
        }

        private void tStrpBtnUndo_Click(object sender, EventArgs e)
        {
            GameChess.Undo();
        }

        private void undoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GameChess.Undo();
        }

        private void tStrpBtnQuit_Click(object sender, EventArgs e)
        {
            DialogResult dlgResult = MessageBox.Show("Are You sure You want to save this programme?",
                           "Comfirm Document Close",
                           MessageBoxButtons.YesNoCancel,
                           MessageBoxIcon.Question);
            if (dlgResult == DialogResult.Yes)
            {
                frmSave save = new frmSave();
                save.ShowDialog(this);
            }
            else
                if (dlgResult == DialogResult.Cancel)
                    return;
            Application.Exit();
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult dlgResult = MessageBox.Show("Are You sure You want to SAVE this programme?",
                           "Comfirm Document Close",
                           MessageBoxButtons.YesNoCancel,
                           MessageBoxIcon.Question);
            if (dlgResult == DialogResult.Yes)
            {
                frmSave save = new frmSave();
                save.ShowDialog(this);
            }
            else
                if (dlgResult == DialogResult.Cancel)
                    return;
            Application.Exit();
        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Chinese Chess\nDisgned by ndluan & dvhung\n version 7.7",
                "Confirm Document Close",
                MessageBoxButtons.OK);
        }

        private void picNetwork_Click(object sender, EventArgs e)
        {
           
        }

        private void SerVer()
        {

            string st, s, _name="";
            int _row, _col, _side, _value;
            st = Client.Receive_Server();

            pler = int.Parse(st);


            Client.Send_Server(txtName.Text.ToString());

            st = Client.Receive_Server();


            if (pler == 0)
            {
                p1.Text = "Player 1: " + txtName.Text.ToString();
                p2.Text = "Player 2: " + st;
            }
            else
            {
                p1.Text = "Player 1: " + st;
                p2.Text = "Player 2: " + txtName.Text.ToString();
            }
           

            GameChess.Set_Playing(pler);
            GameChess.ChangeTurn();


            txtName.Text = pler.ToString();

            while (true)
            {


                st = Client.Receive_Server();

                if (st == "1")// nhan nuoc danh tu sever
                {
                    s = Client.Receive_Server();

                   // listChat.Items.Add(s);

                    _row = int.Parse(s[0].ToString());
                    _col = int.Parse(s[2].ToString());
                    _side = int.Parse(s[s.Length-3].ToString());
                    _value = int.Parse(s[s.Length-1].ToString());

                    for (int i = 4; i < (s.Length - 4); i++)
                    {
                        _name = _name + s[i].ToString();
                    }

                   // listChat.Items.Add(_row.ToString() + " " + _col.ToString() + " " + _name + " " + _side.ToString() +" " + _value.ToString());

                 //  for (int row = 0; row < 10; ++row)
                    //    for (int col = 0; col < 9; ++col)
                        {
                      //      GameChess.PieceMark.SetImage();

                        //    if (Board.Square[row, col].State)
                            {
                          //      if (Board.Square[row, col].Piece == _name)
                                {
                                  // // GameChess.Player[_side - 1].Pawns[0].Value
                                    switch (_value)
                                    {
                                        case 1:
                                            if (_name == "Pawn0")
                                            {
                                                GameChess.Player[_side - 1].Pawns[0].OpenRow(_row);
                                                GameChess.Player[_side - 1].Pawns[0].OpenCol(_col);
                                            }

                                            else if (_name == "Pawn1")
                                            {
                                                GameChess.Player[_side - 1].Pawns[1].OpenRow(_row);
                                                GameChess.Player[_side - 1].Pawns[1].OpenCol(_col);
                                            }

                                            else if (_name == "Pawn2")
                                            {
                                                GameChess.Player[_side - 1].Pawns[2].OpenRow(_row);
                                                GameChess.Player[_side - 1].Pawns[2].OpenCol(_col);
                                            }

                                            else if (_name == "Pawn3")
                                            {
                                                GameChess.Player[_side - 1].Pawns[3].OpenRow(_row);
                                                GameChess.Player[_side - 1].Pawns[3].OpenCol(_col);
                                            }

                                            else if (_name == "Pawn4")
                                            {
                                                GameChess.Player[_side - 1].Pawns[4].OpenRow(_row);
                                                GameChess.Player[_side - 1].Pawns[4].OpenCol(_col);
                                            }

                                            break;
                                        case 2:
                                            if (_name == "Guard0")
                                            {
                                                GameChess.Player[_side - 1].Guards[0].OpenRow(_row);
                                                GameChess.Player[_side - 1].Guards[0].OpenCol(_col);
                                            }

                                            else if (_name == "Guard1")
                                            {
                                                GameChess.Player[_side - 1].Guards[1].OpenRow(_row);
                                                GameChess.Player[_side - 1].Guards[1].OpenCol(_col);
                                            }

                                            break;
                                        case 3:
                                            if (_name == "Elephant0")
                                            {
                                                GameChess.Player[_side - 1].Elephants[0].OpenRow(_row);
                                                GameChess.Player[_side - 1].Elephants[0].OpenCol(_col);
                                            }

                                            else if (_name == "Elephant1")
                                            {
                                                GameChess.Player[_side - 1].Elephants[1].OpenRow(_row);
                                                GameChess.Player[_side - 1].Elephants[1].OpenCol(_col);
                                            }

                                            break;
                                        case 4:
                                            if (_name == "Horse0")
                                            {
                                                GameChess.Player[_side - 1].Horses[0].OpenRow(_row);
                                                GameChess.Player[_side - 1].Horses[0].OpenCol(_col);
                                            }

                                            else if (_name == "Horse1")
                                            {
                                                GameChess.Player[_side - 1].Horses[1].OpenRow(_row);
                                                GameChess.Player[_side - 1].Horses[1].OpenCol(_col);
                                            }
                                            break;
                                        case 5:
                                            if (_name == "Cannon0")
                                            {
                                                GameChess.Player[_side - 1].Cannons[0].OpenRow(_row);
                                                GameChess.Player[_side - 1].Cannons[0].OpenCol(_col);
                                            }
                                            else if (_name == "Cannon1")
                                            {
                                                GameChess.Player[_side - 1].Cannons[1].OpenRow(_row);
                                                GameChess.Player[_side - 1].Cannons[1].OpenCol(_col);
                                            }

                                            break;
                                        case 6:
                                            if (_name == "Rook0")
                                            {
                                                GameChess.Player[_side - 1].Rooks[0].OpenRow(_row);
                                                GameChess.Player[_side - 1].Rooks[0].OpenCol(_col);
                                            }

                                            else if (_name == "Rook1")
                                            {
                                                GameChess.Player[_side - 1].Rooks[1].OpenRow(_row);
                                                GameChess.Player[_side - 1].Rooks[1].OpenCol(_col);
                                            }

                                            break;
                                        case 7:
                                            {
                                                GameChess.Player[_side - 1].King.OpenRow(_row);
                                                GameChess.Player[_side - 1].King.OpenCol(_col);
                                            }

                                            break;

                                    }
                                    
                                    GameChess.UdateOpen();

                                   

                                    GameChess.Set_Playing(pler);
                                    GameChess.ChangeTurn();
                                   // if (_side ==2 )
                                   //     GameChess.Set_Playing(0);
                                  //  else 
                                     //   GameChess.Set_Playing(1);
                                }
                            }

                            ///int  side = ((Pieces)s).Side;


                        }
                    _name = "";
                }
                if (st == "3")
                {

                    s = Client.Receive_Server();
                   

                    _lstChat.Items.Add(s);

                }
                if (st == "4")
                {
                    break;
                }


            }
        }

        private void btnSend_Click(object sender, EventArgs e)
        {

            _lstChat.Items.Add(name + ": " + txtInput.Text.ToString());
            Client.Send_Server("3");
            Client.Send_Server(txtInput.Text.ToString());
            
            txtInput.Text = "";
        }

        private void btnConnect_Click_1(object sender, EventArgs e)
        {
            try
            {
                if (txtName.Text.ToString() != "")
                {


                    if (Client.connect_Server(txtIpServer.Text.ToString()))

                    {
                        name = txtName.Text.ToString();

                        _lstChat = new ListBox();
                        _lstChat.Parent = this;
                        _lstChat.Location = new Point(655, 290);
                        _lstChat.Size = new Size(250, 18 * FontHeight);

                        _Network = true;

                        GameChess.NewGame();

                        if (GameChess.OnPlay)
                        {
                            for (int row = 0; row < 10; ++row)
                                for (int col = 0; col < 9; ++col)
                                {
                                    this.picBoard.Controls.Add(Board.Square[row, col].PicCanMove);
                                    Board.Square[row, col].PicCanMove.MouseClick += new MouseEventHandler(PicCanMove_MouseClick);
                                }
                            AddPiece();
                        }

                        t1 = new Thread(new ThreadStart(SerVer));
                        t1.Start();

                    }
                    else
                    {
                        MessageBox.Show("Do Not connect!");
                    }
                }
                else
                    MessageBox.Show("Not name!");
            }
            catch
            {
                MessageBox.Show("Do Not connect");
            }
        }

        private void btnDisconnect_Click(object sender, EventArgs e)
        {

            Client.Send_Server("4");
            _Network = false;
           //soc.Send_Server("4");
            t1.Abort();

        }

        private void picNetwork_MouseEnter(object sender, EventArgs e)
        {
            picNetwork.Image = Properties.Resources.net1;
            picNetwork.Cursor = Cursors.Hand;
        }

        private void picNetwork_MouseLeave(object sender, EventArgs e)
        {
            picNetwork.Image = Properties.Resources.net0;
        }

        private void picNetwork_MouseClick(object sender, MouseEventArgs e)
        {
            picNetwork.Image = Properties.Resources.net2;
        }

        private void tStrpBtnNew_MouseEnter(object sender, EventArgs e)
        {
            tStrpBtnNew.Image = Properties.Resources.new11;
        }

        private void tStrpBtnNew_MouseLeave(object sender, EventArgs e)
        {
            tStrpBtnNew.Image = Properties.Resources.new02;
        }

        private void tStrpBtnOpen_MouseEnter(object sender, EventArgs e)
        {
            tStrpBtnOpen.Image = Properties.Resources.open1;
        }

        private void tStrpBtnOpen_MouseLeave(object sender, EventArgs e)
        {
            tStrpBtnOpen.Image = Properties.Resources.open0;
        }

        private void tStrpBtnSave_MouseEnter(object sender, EventArgs e)
        {
            tStrpBtnSave.Image = Properties.Resources.save1;
        }

        private void tStrpBtnSave_MouseLeave(object sender, EventArgs e)
        {
            tStrpBtnSave.Image = Properties.Resources.save0;
        }

        private void tStrpBtnSetting_MouseEnter(object sender, EventArgs e)
        {
            tStrpBtnSetting.Image = Properties.Resources.setting1;
        }

        private void tStrpBtnSetting_MouseLeave(object sender, EventArgs e)
        {
            tStrpBtnSetting.Image = Properties.Resources.setting0;
        }

        private void tStrpBtnUndo_MouseEnter_1(object sender, EventArgs e)
        {
            tStrpBtnUndo.Image = Properties.Resources.undo1;
        }

        private void tStrpBtnUndo_MouseLeave_1(object sender, EventArgs e)
        {
            tStrpBtnUndo.Image = Properties.Resources.undo0;
        }

        private void tStrpBtnRedo_MouseEnter(object sender, EventArgs e)
        {
            tStrpBtnRedo.Image = Properties.Resources.redo1;
        }

        private void tStrpBtnRedo_MouseLeave(object sender, EventArgs e)
        {
            tStrpBtnRedo.Image = Properties.Resources.redo0;
        }

        private void tStrpBtnQuit_MouseEnter(object sender, EventArgs e)
        {
            tStrpBtnQuit.Image = Properties.Resources.quit0;
        }

        private void tStrpBtnQuit_MouseLeave(object sender, EventArgs e)
        {
            tStrpBtnQuit.Image = Properties.Resources.quit1;
        }

        public void Send_soc(string temp)
        {
            //soc.Send_Server("1");
          //  soc.Send_Server(temp);
        }
    }
}
